package adv6;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Vector;

public class ClsTest {

	public static void main(String[] args) throws Exception {
		Class c1 = ClsTest.class;// c1描述了ClsTest的全部信息
		Class c = Vector.class;
		Class c2 = int.class;
		Class c4 = Class.forName("java.util.Vector");
		Vector v = new Vector();
		Class c5 = v.getClass();
		System.out.println(c == c4);
		System.out.println(c4 == c5);
		System.out.println(">>>>>>>>>>>>>>>>");
		System.out.println(c.getName());
		System.out.println("父类：" + c.getSuperclass());
		Class[] cr = c.getInterfaces();
		for (Class cc : cr)
			System.out.println(cc);

		System.out.println(">>>>>>>>>>所有的构造方法>>>>>>>>>>");
		Constructor[] ccr = c.getDeclaredConstructors();
		for (Constructor cu : ccr)
			System.out.println(cu);
		System.out.println(">>>>>>>>>>所有的属性：>>>>>>>>>>>>");
		Field[] fr = c.getDeclaredFields();
		for (Field ff : fr)
			System.out.println(ff);
		System.out.println(">>>>>>>>>>所有的方法：>>>>>>>>>>>>");
		Method[] mr = c.getDeclaredMethods();
		for (Method m : mr)
			System.out.println(m);
	}

}
